# -*- coding:utf-8 -*- 
__author__ = 'jiangjun'
__date__ = '2018/3/28 14:19 '

import json
# from utils.common_enum import ReturnEnum
# from utils.response import ResponseData


class JsonUtils:

    @staticmethod
    def obj_2_json_str(obj):
        """
        对象转换为json字符串
        :return:
        """
        dic_data = obj.__dict__
        json_str = json.dumps(dic_data, ensure_ascii=False)
        return json_str

    @staticmethod
    def json_str_2_dict(json_str):
        """
        json字符串转换为对象
        :return:
        """
        dict_data = json.loads(json_str, encoding='utf-8')
        return dict_data


# response_data = ResponseData(ReturnEnum.ERROR.value, '指定流程阶段不存在！')
#
# json_str = JsonUtils.obj_2_json_str(response_data)
# print(json_str)
#
# response = JsonUtils.json_str_2_obj(json_str)
# print(type(response))
# print(response)
#
# class_obj = ResponseData(response)
# print(type(class_obj))
# print(class_obj)




